import Vue from 'vue'
Vue.directive('has', {
    inserted(el, binding) {
        const roles = JSON.parse(localStorage.getItem("USER_URI")).map((item)=>{
            return item.code;
        })
        if (binding.value) {
            const hasPermission = roles.some(role => {
                return binding.value === role
            })
            if (!hasPermission) {
                el.parentNode && el.parentNode.removeChild(el)
            }
        }
    }
})
